package cn.wolfcode.crmspringboot.domain;

import com.alibaba.fastjson.JSON;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;


@Getter
@Setter
@ToString
public class Notice {
    private Long id;
    //发布人
    private Employee issuer;
    //发布时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date pubdate;
    //公告标题
    private String title;
    //是否已读
    private String unknown;
    //公告内容
    private String content;

    public String getUnknown() {
        return unknown==null ? "未读":"已读";
    }

    public String getJson(){
        Map<String,Object> map = new HashMap<>();
        map.put("title", title);
        map.put("content",content);
        return JSON.toJSONString(map);
    }

}